cmake_minimum_required(VERSION 3.10)
project(mymuduo LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# cmake => makefile   make
# mymuduo最终编译成so动态库，设置动态库的路径，放在根目录的lib文件夹下面
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++17 -fPIC")

if(APPLE)
  find_package(epoll-shim REQUIRED)
endif ()
# 定义参与编译的源代码文件 
aux_source_directory(. SRC_LIST)
# 编译生成动态库mymuduo
add_library(mymuduo SHARED ${SRC_LIST})

target_include_directories(mymuduo
        PRIVATE
        ${PROJECT_SOURCE_DIR}
        /usr/local/include/libepoll-shim
)

target_link_libraries(mymuduo
        PRIVATE
        epoll-shim::epoll-shim
        epoll-shim::epoll-shim-interpose
)